export function http(params) {
	let {
		url,
		headers,
		data,
		method = 'GET'
	} = params;
	let token = '';
	url = `${url}`;
	let ajaxPropmise = new Promise((resolve, reject) => {
		uni.request({
			url: url,
			data,
			method,
			// header: { token: token, 'Content-Type': 'application/x-www-form-urlencoded', ...headers },
			header: {
				'Authorization': token,
				'Content-Type': 'application/json',
				...headers
			},
			dataType: 'json',
			responseType: 'text',
			success: function(res) {
				resolve(res.data);
			},
			fail: function(res) {},
			complete: function(res) {},
		})
	});
	return ajaxPropmise.then((data) => {
		return data;
	}).catch(err => {
		console.log(err);
		return {
			data: null
		};
	});
}